﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Chat
{
    /// <summary>
    /// TestWindow.xaml 的交互逻辑
    /// </summary>
    public partial class TestWindow : Window
    {
        public TestWindow()
        {
            InitializeComponent();
        }


        private async void WhenTest(object sender, RoutedEventArgs e)
        {
            (sender as Button).IsEnabled = false;
            await Client.StartClient()
               .ContinueWith((task) =>
               {
                   Client.CurrentService = task.Result;
                   while(true)
                   {
                       for (int i = 0; i < 100; i++)
                       {
                           Client.CurrentService.Perfermance(Client.CurrentUser);
                       }
                       Application.Current.Dispatcher.Invoke(() =>
                       {
                           txtStatus.Text = string.Concat(txtStatus.Text, Environment.NewLine, $"发送了100条数据@{DateTime.Now.ToString("HH:mm:ss")}");
                       });

                   }
                   
               });
        }
    }
}
